#if UNITY_EDITOR || UNITY_STANDALONE_WIN
using System.IO;

 namespace CFree.Common.Script
 {
     public static class StreamingLuaLoader
     {
         static readonly string s_luaPathPattern;

         static StreamingLuaLoader()
         {
             string debugLuaFolder = Path.Combine(UnityEngine.Application.streamingAssetsPath, "LuaScript");
             s_luaPathPattern = Path.Combine(debugLuaFolder, "{0}.lua");
         }

         public static byte[] Load(ref string modulePath)
         {
             string filePath = modulePath.Replace('.', Path.DirectorySeparatorChar);
             string fullPath = string.Format(s_luaPathPattern, filePath);
             return File.Exists(fullPath) ? File.ReadAllBytes(fullPath) : null;
         }
     }
 }
#endif